<?php
//naredi include, mora biti {}
require_once 'projekt_st/spletne/controller/ProfesorController.php';
include_once("seja.php"); 
{
	$streznik = $_SERVER["HTTP_HOST"];  			
	$pot = rtrim(dirname($_SERVER["PHP_SELF"]), "/\\");
    
	$control  = new ProfesorController();
	
	//struktura arraya = array([0] => array(assoc_podatki_o_predmetu, [ucenec] => objekt ucenca))
	$ucenci = $control->getUcenci($_SESSION["uporabnik"]["idprofesor"]);
	//echo "UCENCI IN PREDMETI: <br>";
	//print_r($ucenci);
	
	
	if(isset($_POST["oceni"])){
		//$ocena = array();
		//$ocena["ocena"]
		//echo "POSTANO: <br>";
		//print_r($_POST);
		$control->saveOcena($_POST["idStud"], array("ocena" => $_POST["ocena"]),$_POST["predmet"]);
		header( "Location: http://".$streznik."".$pot."/oceni.php" );
	}
	
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>StudentWorld</title>
    <link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
    <div id="wrapper">
    	<div id="header-wrapper">
        
    		<?php include_once("glava.php"); ?>
            
    	</div>
    	<!-- end #header -->
    	<div id="page">
    		<div id="page-bgtop">
    			<div id="page-bgbtm">
    				<div id="content">
    					<div class="post">    						
    						<div style="clear: both;">&nbsp;</div>
    						<div class="entry">
    							<p>Izpis študentov</p>
                                <p>
                                        <div>
                                        <table>
                                        	<th>ucenec</th>
                                        	<th>predmet</th>
                                        	<th>ocena</th>
                                        	<?php foreach($ucenci as $ucenec):?>
                                        	<form method="post" action="<?php echo $_SERVER["PHP_SELF"] ?>">
                                            <tr>
                                                <td><?php echo $ucenec["ucenec"]->getIme()." ".$ucenec["ucenec"]->getPriimek()?></td>
                                                <td><?php echo $ucenec["predmet"]?></td>
                                            	<td><input type="text" name="ocena" id="ocena" value="<?php echo $ucenec["ocena"]?>" /></td>
                                            	<td><input type="submit" id="oceni" name="oceni" value="OK" /></td>
                                            	<input type="hidden" id="idStud" name="idStud" value="<?php echo $ucenec["ucenec"]->getIdoseba()?>" />
                                            	<input type="hidden" name="predmet" value="<?php echo $ucenec["predmet"]?>" />
                                            </tr>
                                            </form>
                                            <?php endforeach;?>
                                            
                                        </table>
                                		<p></p>
                                        
                                        </div>
                                	</p>
    						</div>
    					</div>
    					
    					<div style="clear: both;">&nbsp;</div>
    				</div>
    				<!-- end #content -->
    				<div id="sidebar">
    					<ul>
    						
                            <?php

                                include_once('sidebar.php');

?>
    					</ul>
    				</div>
    				<!-- end #sidebar -->
    				<div style="clear: both;">&nbsp;</div>
    			</div>
    		</div>
    	</div>
    	<!-- end #page -->
    </div>
    <?php  include_once("noga.php"); } ?>
    <!-- end #footer -->
</body>
</html>
